<template>
  <div>
    <articesC :newlist="newlist" ifproprs="dianzan"></articesC>
  </div>
</template>

<script>
import articesC from '../../../../components/artices'
import { getmyblog } from '../../../../api/blogone'

export default {
  components: {
    articesC
  },
  data () {
    return {
      list: [],
      newlist: []
    }
  },
  methods: {
    async run(page = 0) {
      const res = await getmyblog({
        page,
        query:'',
        loginUserId: JSON.parse(window.localStorage.getItem('user')).id
      })
      console.log(res);
      // this.list = res.data.data
      // this.newlist = this.getLength(this.list)
    },
    getLength(res) {
      let lists = []
      for(let i=0;i<res.length;i++) {
        if (res[i].ifpeaise === 1) {
          lists.push(res[i])
        }
      }
      // console.log(newlist);
      this.$store.commit('updatemyPraiseLength', lists.length)
      return lists
    }
  },
  created() {
    // this.run(1)
  }
}
</script>

<style>

</style>